//
//  ViewController.m
//  zhugeDemo
//
//  Created by 静竹 on 2019/6/11.
//  Copyright © 2019 threeti. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    [self zhugeStartTrackWithPageName:@"uniquePageName"];
}

-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    [self zhugeEndTrackWithPageName:@"uniquePageName"];
}



- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    [self zhugeTrackWithPageTypeName:@"news"];
    [self zhugeTrackWithPageTypeName:@"articles"];
    [self zhugeTrackWithPageTypeName:@"images"];
}


-(void)zhugeStartTrackWithPageName:(NSString *)pageName
{
     [[Zhuge sharedInstance] startTrack:pageName];
}

-(void)zhugeEndTrackWithPageName:(NSString *)pageName
{
    [[Zhuge sharedInstance] endTrack:pageName properties:[NSDictionary dictionary]];
}

-(void)zhugeTrackWithPageTypeName:(NSString *)typeName
{
     [[Zhuge sharedInstance] track:typeName properties:nil];
}





//识别用户
-(void)getUserInfo
{
    //定义诸葛io中的用户ID
    NSString *userId = @"1212";
    
    //定义属性
    NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
    userInfo[@"name"] = @"zhuge";
    userInfo[@"gender"] = @"男";
    userInfo[@"birthday"] = @"2014/11/11";
    userInfo[@"avatar"] = @"http://tp2.sinaimg.cn/2885710157/180/5637236139/1";
    userInfo[@"email"] = @"hello@zhuge.io";
    userInfo[@"mobile"] = @"18901010101";
    userInfo[@"qq"] = @"91919";
    userInfo[@"weixin"] = @"121212";
    userInfo[@"weibo"] = @"122222";
    userInfo[@"location"] = @"北京朝阳区";
    userInfo[@"公司"] = @"37degree";
    [[Zhuge sharedInstance] identify:userId properties:userInfo];
}



@end
